In [1]:
import pandas as pd
import pandas_datareader as web
import numpy as np
import pytrends
We want:
make a google account for the purpose of getting google d trends.
In [2]:
from pytrends.request import TrendReq
In [12]:
google_username = "mm.trends.api@gmail.com"
google_password = ""
path = ""
In [8]:
# connect to Google
pytrend = TrendReq(google_username, google_password, custom_useragent='Pytrends')
In [5]:
trend_payload = {'q': 'Pizza, Italian, Spaghetti, Breadsticks, Sausage', 'cat': '0-71'}
In [ ]:
# trend
trend = pytrend.trend(trend_payload)
print(trend)
df = pytrend.trend(trend_payload, return_type='dataframe')
In [7]:
df
Out[7]:
In [ ]:
# toprelated
toprelated = pytrend.related(trend_payload, related_type='top')
print(toprelated)
risingrelated = pytrend.related(trend_payload, related_type='rising')
print(risingrelated)
# top30in30
top30in30 = pytrend.top30in30()
print(top30in30)
country_payload = {'geo': 'US'}
# hottrends
hottrends = pytrend.hottrends(country_payload)
print(hottrends)
# hottrendsdetail
# returns XML data
hottrendsdetail = pytrend.hottrendsdetail(country_payload)
print(hottrendsdetail)
payload = {'date': '201601', 'geo': 'US'}
# alltopcharts
topcharts = pytrend.topcharts(payload)
print(topcharts)
keyword = 'pizza'
# suggestions
suggestions = pytrend.suggestions(keyword)
print(suggestions)
GOOGLEINDEX_US:ADVERT This Google Advertising & Marketing Index tracks searches related to (marketing, advertising, commercials...)
GOOGLEINDEX_US:AIRTVL This Google Air Travel Index tracks searches related to (airlines, airline, flights...)
GOOGLEINDEX_US:AUTOBY This Google Auto Buyers Index tracks searches related to (car, blue book...)
GOOGLEINDEX_US:AUTOFI This Google Auto Financing Index tracks searches related to (loan, car lean...)
GOOGLEINDEX_US:AUTO This Google Automotive Index tracks searches related to (car, honda, toyota...)
GOOGLEINDEX_US:PERFIN This Google Personal Finance Index tracks searches related to (bank, bank of america...)
GOOGLEINDEX_US:BIZ This Google Business Index tracks searches related to (calendar, business, salary...)
GOOGLEINDEX_US:COMPUT This Google Computers & Electronics Index tracks searches related to (windows, download, microsoft...)
GOOGLEINDEX_US:CONSTR This Google Construction Index tracks searches related to (doors, construction...)
GOOGLEINDEX_US:CREDIT This Google Credit & Lending Index tracks searches related to (credit, credit card, loans...)
GOOGLEINDEX_US:DURBLE This Google Durable Goods Index tracks searches related to (vacuum, appliances, refrigerator...)
GOOGLEINDEX_US:FININS This Google Finance & Insurance Index tracks searches related to (stock, bank, yahoo...)
GOOGLEINDEX_US:FURNTR This Google Furniture Index tracks searches related to (ikea, furniture, table...)
GOOGLEINDEX_US:INDUST This Google Industries Index tracks searches related to (home, energy, usps...)
GOOGLEINDEX_US:INVEST This Google Investing Index tracks searches related to (finance, stocks, capital, stock...)
GOOGLEINDEX_US:JOBS This Google Jobs Index tracks searches related to (city, jobs, resume, monster...)
GOOGLEINDEX_US:LUXURY This Google Luxuries Index tracks searches related to (diamond, jewelers, rings, tiffany...)
GOOGLEINDEX_US:MTGE This Google Mortgage Index tracks searches related to (mortgage calculator, mortage rates, mortgage...)
GOOGLEINDEX_US:RLEST This Google Real Estate Index tracks searches related to (mortgage,apartmenents, real estate, rent...)
GOOGLEINDEX_US:RENTAL This Google Rental Index tracks searches related to (for rent, rent, rentals...)
GOOGLEINDEX_US:RETAIL This Google Retail Index tracks searches related to (bags, vending, retail...)
GOOGLEINDEX_US:TRAVEL This Google Travel Index tracks searches related to (hotel, vegas, airlines...)
GOOGLEINDEX_US:UNEMPL This Google Unemployment Index tracks searches related to (social security, unemployment...)
In [12]:
gt = pd.read_table?
In [ ]:
gt = pd.read_clipboard(index_col)
In [9]:
gt
Out[9]:
In [ ]:
In [ ]: